package search;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;


/**
 * data of one row that returns from search action
 * @author ran
 *
 */
public class SearchTuple implements Serializable{
	
	private static final long serialVersionUID = 1L;
	private String fileName;
	private String boxName;
	private int size;
	private Date lastModify;
	private ArrayList<String> tags= new ArrayList<String>();
	/**
	 * @return the file name
	 */
	public String getFileName() {
		return fileName;
	}
	/**
	 * set method of the member fileName
	 * @param fileName the new value of fileName
	 */
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	/**
	 * @return the folder name
	 */
	public String getBoxName() {
		return boxName;
	}
	/**
	 * set method of the member boxName
	 * @param boxName the new value of boxName
	 */
	public void setBoxName(String boxName) {
		this.boxName = boxName;
	}
	/**
	 * @return the size of the file
	 */
	public int getSize() {
		return size;
	}
	/**
	 * set method of the member size
	 * @param size the new value of size
	 */
	public void setSize(int size) {
		this.size = size;
	}
	/**
	 * @return the date when the file is last modified
	 */
	public Date getLastModify() {
		return lastModify;
	}
	/**
	 * set method of the member lastModify
	 * @param date the new value of lastModify
	 */
	public void setLastModify(Date date) {
		this.lastModify = date;
	}
	/**
	 * @return the tags of the file
	 */
	public ArrayList<String> getTags() {
		return tags;
	}
	/**
	 * add tag to the tag list
	 * @param tag the new tag to add to the tag list
	 */
	public void addTags(String tag) {
		this.tags.add(tag);
	}
	/**
	 * @return an array with all the row data
	 */
	public String[] toArray(){
		System.out.println(fileName+" "+boxName+" "+Integer.toString(size)+" "+lastModify.toString()+" "+toString());
		String arr[]=new String[]{fileName,boxName,Integer.toString(size),lastModify.toString(),toString()};
		return arr;
	}
	@Override
	public String toString() {
		StringBuffer line = new StringBuffer();
		for(int i=0;i<tags.size();i++){
			line.append(tags.get(i));
			if(i!=tags.size()-1)
				line.append(',');
		}
		return line.toString();
	}
}
